import globalConfig from "@/utils/config.js";
import { request } from "@/utils/http.js";

const baseUrl = globalConfig.microUrl;

export default {
  // 商品分类-首页
  categories: data => {
    return request({
      url: `${baseUrl}/gd/goodsCate/listAll`,
      method: "GET",
      data,
    });
  },
  // 获取商品列表
  getGoods: data => {
    return request({
      url: `${baseUrl}/gd/goods/search`,
      method: "GET",
      data,
    });
  },
  // 获取商品列表,首页推荐分类
  getGoodsCateFixed: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsCateFixed`,
      method: "GET",
      data,
    });
  },
  // 获取商品详情-banner
  getGoodsImage: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsImage`,
      method: "GET",
      data,
    });
  },
  // 获取商品详情信息 （未登录）
  getGoodsDetail: data => {
    return request({
      url: `${baseUrl}/gd/goods/get`,
      method: "GET",
      data,
    });
  },
  // 获取商品sku阶梯价
  findGoodsStairListBySkuId: data => {
    return request({
      url: `${baseUrl}/gd/goodsSku/findGoodsStairListBySkuId`,
      method: "GET",
      data,
    });
  },
  // 获取规格及sku详情
  getGoodsSkuV2: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsSkuV2`,
      method: "GET",
      data,
    });
  },
  // 第一次调用
  getGoodsSkuFirst: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsSkuFirst`,
      method: "GET",
      data,
    });
  },

  // 获取商品详情信息 (已登录)
  getHaveTokenGoodsDetail: data => {
    return request({
      url: `${baseUrl}/gd/goods/get`,
      method: "GET",
      data,
    });
  },
  // 获取试剂商品详情
  getProduct: data => {
    return request({
      url: `${baseUrl}/gd/goods/getProduct`,
      method: "GET",
      data,
    });
  },
  // 获取品牌详情
  getBrandGoodsInfo: data => {
    return request({
      url: `${baseUrl}/gd/brand/get`,
      method: "GET",
      data,
    });
  },
  // 获取品牌全部
  getBrandListAll: data => {
    return request({
      url: `${baseUrl}/gd/brand/listAll`,
      method: "GET",
      data,
    });
  },

  // 获取商品规格和仓库
  getGoodsSku: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsSku`,
      method: "GET",
      data,
    });
  },
  // 获取商品详情和属性
  getGoodsContentAndAttr: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsContentAndAttr`,
      method: "GET",
      data,
    });
  },
  // 档案
  document: data => {
    return request({
      url: `${baseUrl}/gd/document/getByGoodsId`,
      method: "GET",
      data,
    });
  },
  // 资讯详情  ZCL
  detailContent: data => {
    return request({
      url: `${baseUrl}/ct/news/get`,
      method: "GET",
      data,
    });
  },
  // 查看是否已收藏
  getFavourite: data => {
    return request({
      url: `${baseUrl}/member/memberFavourite/get`,
      method: "GET",
      data,
    });
  },
  // 收藏商品
  addFavourite: data => {
    return request({
      url: `${baseUrl}/member/memberFavourite/create`,
      method: "POST",
      data,
    });
  },
  // 推荐商品
  getIndexRecommendGoods: data => {
    return request({
      url: `${baseUrl}/gd/goods/getIndexRecommendGoods`,
      method: "GET",
      data,
    });
  },
  // 获取购物车数量
  listCount: data => {
    return request({
      url: `${baseUrl}/cart/listCount`,
      method: "GET",
      data,
    });
  },
  // 获取购物车数量
  listCountV2: data => {
    return request({
      url: `${baseUrl}/cart/listCountV2`,
      method: "GET",
      data,
    });
  },
  // 根据店铺ID获取店铺详情
  getStoreDetail: data => {
    return request({ url: `${baseUrl}/store/get`, method: "GET", data });
  },
  // 根据店铺ID获取店铺详情
  findStoreCustomerById: data => {
    return request({
      url: `${baseUrl}/store/storeCustomer/findStoreCustomerById`,
      method: "GET",
      data,
    });
  },

  // 获取椰氏推荐商品列表
  getBrandGoodsList: data => {
    return request({
      url: `${baseUrl}/gd/goods/getBrandGoodsList`,
      method: "POST",
      data,
    });
  },

  // 商品分类-巴斯夫
  BASFCategories: data => {
    return request({
      url: `${baseUrl}/gd/goodsCate/listByBrands`,
      method: "GET",
      data,
    });
  },
  // 获取常用采购列表
  getCommonlyUsedPurchases: data => {
    return request({
      url: `${baseUrl}/gd/goods/getCommonlyUsedPurchases`,
      method: "GET",
      data,
    });
  },
  /** ********************************************** 限时抢购 ********************************************************* */

  // 获取已登录限时抢购详情
  getMarketActivity: data => {
    return request({
      url: `${baseUrl}/market/activity/get`,
      method: "GET",
      data,
    });
  },
  // 校验活动限购数量
  getActivityAmount: data => {
    return request({
      url: `${baseUrl}/order/getActivityAmount`,
      method: "GET",
      data,
    });
  },
  // 获取未登录限时抢购详情
  getWithoutLogin: data => {
    return request({
      url: `${baseUrl}/market/activity/getWithoutLogin`,
      method: "GET",
      data,
    });
  },
  // 获取限时抢购进度条
  getStockRadio: data => {
    return request({
      url: `${baseUrl}/market/activity/getStockRadio`,
      method: "GET",
      data,
    });
  },
  // 获取限时抢购活动列表
  getMarketActivityList: data => {
    return request({
      url: `${baseUrl}/market/activity/page`,
      method: "GET",
      data,
    });
  },

  // 获取卖方公司信息
  getPlate: data => {
    return request({
      url: `${baseUrl}/gd/goods/getByGoodsId`,
      method: "GET",
      data,
    });
  },
  // 获取卖方公司信息
  getPlateBysellCompanyId: data => {
    return request({
      url: `${baseUrl}/cp/company/get`,
      method: "GET",
      data,
    });
  },
  // 限购数量
  checkGoodsLimitBuyCount: data => {
    return request({
      url: `${baseUrl}/gd/goods/checkGoodsLimitBuyCount`,
      method: "POST",
      data,
    });
  },
  // 首页分类
  findGroupList: data => {
    return request({
      url: `${baseUrl}/gd/recommendGroup/getGroupList`,
      method: "GET",
      data,
    });
  },
  // 首页分类下商品
  findGroupGoodsList: data => {
    return request({
      url: `${baseUrl}/gd/recommendGroup/getGroupGoodsList`,
      method: "GET",
      data,
    });
  },
  // 店铺模板推荐商品
  shopTemplateGoodsList: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsList`,
      method: "GET",
      data,
    });
  },
  // 获取平台活动ID
  getJingXiPurchaseId: data => {
    return request({
      url: `${baseUrl}/market/activity/getJingXiPurchaseId`,
      method: "GET",
      data,
    });
  },
  // 获取是否已预约
  isNationalDayReserve: data => {
    return request({
      url: `${baseUrl}/member/reserve/isNationalDayReserve`,
      method: "GET",
      data,
    });
  },
  // 提交预约
  reserveNationalDay: data => {
    return request({
      url: `${baseUrl}/member/reserve/reserveNationalDay`,
      method: "POST",
      data,
    });
  },
  // 获取购买普通危险品的状态流程
  getGoodsProcessStatus: data => {
    return request({
      url: `${baseUrl}/gd/goods/getGoodsProcessStatus`,
      method: "POST",
      data,
    });
  },
};
